package com.chengxiaoxiao.ai_demo.exception;

import cn.hutool.core.util.StrUtil;
import com.chengxiaoxiao.ai_demo.vo.CodeMsg;
import lombok.Getter;

/**
 * 全局统一异常信息
 *
 * @Description: 所有的异常都抛出此异常
 * @Author Cheng Xiaoxiao
 * @Date: 2025/3/13 09:11
 */
@Getter
public class GlobalException extends RuntimeException {

    private static final long serialVersionUID = 7331906799009231998L;
    private final CodeMsg cm;

    public GlobalException(CodeMsg cm) {
        super(StrUtil.format("{}-{}", cm.getCode(), cm.getMsg()));
        this.cm = cm;
    }
}